package org.hd.sidemenu.controller;

import cn.dev33.satoken.util.SaResult;
import org.hd.sidemenu.service.SideMenuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sideMenus/")
public class SideMenuController {

    @Resource
    SideMenuService sideMenuService;

    @GetMapping("getSideMenus")
    public SaResult getSideMenus(
            @RequestParam String username
    ){
        List<Map<String,Object>> menus = sideMenuService.getMenus(username);
        if(null != menus){
            return new SaResult(200,"获取成功",menus);
        }
        return SaResult.error("获取失败");
    }


}
